<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.sql.*"%>
<%@page language="java" import="java.util.*"%>
<%@page import="java.*" %>


<%          String stSuid = (String) session.getAttribute("suid");
            String stname = request.getParameter("stName");
            String rd1 = request.getParameter("rd1");
            String stDOB = request.getParameter("stDOB");
            String stPgName = request.getParameter("stPgName");
            String stAddr = request.getParameter("stAddr");
            String stPhoneNo = request.getParameter("stPhoneNo");
            String stEmail = request.getParameter("stEmail");
            String stTenthPercentage = request.getParameter("stTenthPercentage");
            String stTenthSchool = request.getParameter("stTenthSchool");
            String stTenthBoard = request.getParameter("stTenthBoard");
            String stTwelfthPercentage = request.getParameter("stTwelfthPercentage");
            String stTwelfthSchool = request.getParameter("stTwelfthSchool");
            String stTwelfthBoard = request.getParameter("stTwelfthBoard");
            String stIdMark = request.getParameter("stIdMark");
            String stBGroup = request.getParameter("stBGroup");
            Connection connection = null;
            try {

                String driverName = "oracle.jdbc.driver.OracleDriver";
                Class.forName(driverName);

                // Create a connection to the database
                String serverName = "10.0.0.27";
                String portNumber = "1521";
                String sid = "XE";
                String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;
                String uname = "aranya27";
                String pword = "doodledo";

                connection = DriverManager.getConnection(url, uname, pword);


                String DOB = stDOB;
                char[] ddate = DOB.toCharArray();
                char[] ddate1 = DOB.toCharArray();
                ddate[0] = ddate1[3];
                ddate[1] = ddate1[4];
                ddate[3] = ddate1[0];
                ddate[4] = ddate1[1];
                String stDOB1 = new String(ddate);

                // enter code here

                Statement st = null;
                st = connection.createStatement();
                String str = "update aranya27.student_details set  suid="+ stSuid + ",sname='" + stname + "',address='" + stAddr + "',gender='" + rd1 + "',dob='" + stDOB1 + "',phone_no=" + stPhoneNo + ",email='" + stEmail + "',guardian_name='" + stPgName + "',tenth_percentage=" + stTenthPercentage + ",twelfth_percentage=" + stTwelfthPercentage + ",tenth_school='" + stTenthSchool + "',twelfth_school='" + stTwelfthSchool + "',tenth_board='" + stTenthBoard + "',twelfth_board='" + stTwelfthBoard + "',identification_mark='" + stIdMark + "',blood_group='" + stBGroup + "'where suid="+stSuid;
                st.executeUpdate(str);
                connection.close();
                response.sendRedirect("studentHome.jsp");
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
                System.out.println(" Could not find the database driver");
            } catch (SQLException e) {
                e.printStackTrace();
                System.out.println("Could not connect to the database");
            }



%>